package main.request;

import java.io.IOException;

import utils.Debug;
import main.process.FtpRequest;


public class RequestFeat implements ProcessRequestInterface {

	private static class SingletonHolder
	{		
		/** Instance unique non préinitialisée */
		private final static RequestFeat instance = new RequestFeat();
	}

	public static RequestFeat getInstance()
	{
		return SingletonHolder.instance;
	}

	@Override
	public void processRequest(String[] request, FtpRequest ftp) throws IOException {
		Debug.debug(this.getClass().getName(), request, ftp.getDebug());

		if(!request[0].equals("FEAT"))
		{
			next(request, ftp);
		}
		else 
		{
			ftp.write("211-Extensions supported:");
			ftp.write(" SIZE");
			ftp.write(" MLST Size*;Modify*;");
			ftp.write("211 End");
			ftp.myFlush();
		}

	}

	@Override
	public void next(String[] request, FtpRequest ftp) throws IOException {
		RequestList.getInstance().processRequest(request, ftp);

	}
}
